/*
 * \file TraitListModel.h
 *
 * \date Jan 9, 2009
 * \author Sarah Smith <sez@storybridge.org>
 */

#ifndef TRAITLISTMODEL_H_
#define TRAITLISTMODEL_H_

#include <QStandardItemModel>
#include <QString>
#include <QList>
#include <QIcon>

#include <DndData/Trait.h>
#include <DndData/Power.h>
#include <DndData/Race.h>
#include <DndData/Feat.h>
#include <Xml/XmlPath.h>

class QObject;

template <class T>
class TraitListModel: public QStandardItemModel
{
public:
    TraitListModel(const XmlPath &path, QIcon icon, QObject *parent = 0);
    virtual ~TraitListModel();
    QList<T> selected() const;
    void setSelected(QList<T>);
    void add(T);
public:
    QList<T> mData;
};

typedef TraitListModel<Trait> TraitModel;
TraitModel *makeTraitModel(const XmlPath &path, QObject *parent = 0);

typedef TraitListModel<Power> PowerModel;
PowerModel *makePowerModel(const XmlPath &path, QObject *parent = 0);

typedef TraitListModel<Feat> FeatModel;
FeatModel *makeFeatModel(QObject *parent = 0);

typedef TraitListModel<Race> RaceModel;
RaceModel *makeRaceModel(QObject *parent = 0);

#endif /* TRAITLISTMODEL_H_ */
